package com.hwl.demo9;

import com.hwl.demo9.entity.Director;
import com.hwl.demo9.entity.Product;
import com.hwl.demo9.service.Builder;
import com.hwl.demo9.service.impl.ConcreteBuilder1;
import com.hwl.demo9.service.impl.ConcreteBuilder2;

/**
 * 建造者模式
 *
 * @author sentry
 * @since 2023-03-19
 */
public class Main {

    public static void main(String[] args) {
        Director director = new Director();
        Builder cb1 = new ConcreteBuilder1();
        Builder cb2 = new ConcreteBuilder2();

        director.construct(cb1);
        Product p1 = cb1.getResult();
        p1.show();

        director.construct(cb2);
        Product p2 = cb2.getResult();
        p2.show();
    }
}
